<?php

if (!isset($_GET['f']) || !isset($_GET['t'])) 
{
	exit('File or Type not specified!');
}

$aAllowed = array('js', 'css');

if (!in_array($_GET['t'], $aAllowed))
{
	exit('File type not allowed!');	
}

if (strlen($_GET['f']) != 32)
{
	exit('File string not allowed!');
}

define('DIR', dirname(dirname(dirname(__FILE__))) . '/');
define('GZIP_DO_CACHE', DIR . 'file/cache/');
define('CACHED_FILE', DIR . 'file/cache/' . $_GET['f'] . '.' . $_GET['t']);

if (!file_exists(CACHED_FILE)) 
{
	exit('Invalid File!');
}

require_once DIR . 'include/functions/Gzip.functions.php';

doGzip(file_get_contents(CACHED_FILE), ($_GET['t'] == 'js' ? 'javascript' : 'css'));

?>